package com.control;

import java.util.Scanner;

/**
 * Version: 1.1
 * Author: TangJun
 * Date: 2024-07-27
 */
public class B extends Thread{
    private A a;
    public B(A a) {
        this.a = a;
    }
    @Override
    public void run() {
        Scanner scan = new Scanner(System.in);
        char ch = 0;
        //按Q终止线程
        while (ch != 'Q') {
            System.out.println("输入q退出");
            ch = scan.next().toUpperCase().charAt(0);
        }
        a.setLoop(false);
        System.out.println("退出B线程");
    }
}
